<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body,
      ul {
        margin: 0;
        padding: 0;
      }
      body {
        width: 100%;
        height: 100%;
        background-image: url(../../images/grid.png);
      }
      svg {
        background-color: rgba(255, 0, 0, 0.1);
      }
    </style>
  </head>
  <body>
    <svg width="300" height="300">
      <path
        id="linePath"
        d="M 0 100, L 100 30, L 200, 100, L 300, 30"
        fill="transparent"
        stroke="red"
      />

      <rect x="-10" y="-5" width="20" height="10" fill="red" rx="3" ry="4">
        <animateMotion dur="5s" rotate="auto">
          <mpath xlink:href="#linePath" />
        </animateMotion>
      </rect>
    </svg>
  </body>
</html>
